package com.program.beautymakeup.utils;

import com.alibaba.fastjson.JSON;
import com.program.beautymakeup.domain.entity.User;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Objects;
import java.util.Optional;

/**
 * @author CaiKe
 * @date 2023/2/7 20:47
 */
//public class SecurityUtil {
//
//    public static int getCurrentUserId(){
//        final User currentUser = getCurrentUser();
//        return currentUser != null ? currentUser.getUserId() : -1;
//    }
//
//    private static HttpSession getCurrentRequestSession() {
//        return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest().getSession();
//    }
//
//    public static User getCurrentUser(){
//        return (User) getCurrentRequestSession().getAttribute("user");
//    }
//
//
//
//}